package com.karry.yl.dao.financial;

import com.karry.commons.base.SuperMapper;
import com.karry.yl.domain.financial.Receipt;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.math.BigDecimal;


public interface ReceiptMapper extends SuperMapper<Receipt> {

    @Update("update receipt set status = 3 ,paymentTime = now(),realAmount = #{realAmount},paymentMethod=#{paymentMethod} where code = #{code} ")
    void updateStatusForPayment(@Param("code") String code, @Param("realAmount") BigDecimal realAmount,@Param("paymentMethod") int paymentMethod);

    @Select("select count(*) from receipt where deleted = 0 and status = #{status} and code = #{code}")
    int selectByStatus(@Param("status") int status,@Param("code") String code);
}
